package cn.tianya.irock.view;

import cn.tianya.irock.bll.Attachments;
import cn.tianya.irock.bll.SiteManager;
import cn.tianya.irock.bll.Users;
import cn.tianya.irock.core.Page;
import cn.tianya.irock.data.model.Site;
import cn.tianya.irock.data.model.User;
import cn.tianya.irock.enums.PostFileResult;
import cn.tianya.irock.util.JSONUtil;

public class FilePage extends Page {

	@Override
	public void show() {
	}
	
	public void recv() {
		int siteId = request.getIntParameter("site_id");
		Site site = null;
		User user = null;
		PostFileResult result = null;
		
		site = SiteManager.getSite(siteId);
		user = Users.getUser();
		result = Attachments.addAttachment(site, user, request.getFiles(), "");
		super.render(JSONUtil.toSimpleString(result));
	}

}
